Function |signum

std/ops/num::|signum


Usage

|signum<N>(value)

Generics

◻ N: Signed

Parameters

↳ value: N

Return

↴ N


Return number representing sign of given value.

  • 0 if number is 0,
  • -1 if number is negative,
  • 1 if number is positive.

ℹ️ For floating types (f32 and f64), NaN values gives NaN output, +INFINITY and +0.0 gives 1, -INFINITY and -0.0 gives -1.